part of '../repository.dart';

class _WebPaymentMethodDtoFactory {
  const _WebPaymentMethodDtoFactory._internal();

  static const _instance = _WebPaymentMethodDtoFactory._internal();

  factory _WebPaymentMethodDtoFactory() {
    return _instance;
  }

  _WebPaymentMethodDto fromJson(Map<String, dynamic> json) {
    final paymentSystem = json[_kWebPaymentMethodPaymentSystemKey] as String;

    if (paymentSystem == _kWebPaymentMethodPaymentSystemValue) {
      return _YookassaPaymentMethodDto.fromJson(json);
    }

    throw UnimplementedError();
  }

  _WebPaymentMethodDto fromEntity(WebPaymentMethod paymentMethod) {
    if (paymentMethod is YookassaPaymentMethod) {
      return _YookassaPaymentMethodDto.fromEntity(paymentMethod);
    }

    throw UnimplementedError();
  }
}
